﻿using KTWpm.Management.Domain;
using KTWpm.Management.Domain.Entities;
using KTWpm.Management.Domain.ValueObjects;

namespace KTWpm.Management.Api.Infrastructure;

public class BreedService : IBreadService
{
    public readonly List<Bread> Breeds = [
         new Bread(Guid.Parse("3fa85f64-5717-4562-b3fc-2c963f66afa6"),
             "Baguette",
          new WeightRange(12.5m,20.6m),
          new WeightRange(12m,20m)),
        new Bread(Guid .Parse("3fa85f64-5717-4562-b3fc-2c963f66aff7")      ,
             "Staff",
          new WeightRange(22.5m,34.6m),
          new WeightRange(20m,30m)),
        ];

    public Bread? GetBreed(Guid id)
    {
        if (id == Guid.Empty)
        {
            throw new ArgumentException("Breed is not valid.");
        }
        var result = Breeds.Find(b => b.Id == id);
        return result ?? throw new ArgumentException("Breed was not found");
    }
}
